package com.zzzzzz.content.tag;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.google.code.morphia.query.Query;
import com.zzzzzz.common.util.StringPool;
import com.zzzzzz.core.dao.morphia.BaseDao;

@Repository("tagDao")
public class TagDaoImpl extends BaseDao implements TagDao {

	@Override
	public void add(Tag tag) {
		db.save(tag);
	}
	
	@Override
	public List<Tag> findAll() {
		Query<Tag> query = db.createQuery(Tag.class);
		String condition = StringPool.DASH + "orderNb";
		query.order(condition);
		return query.asList();
	}
	
}
